<template>
  <page-wrap :show-top="showTop" bg-color="transparent">
    <!-- #ifdef MP-WEIXIN -->
    <!-- <template #title>
      <image class="logo" :src="logoSrc"></image>
    </template> -->
    <!-- #endif -->
    <view v-if="isShowPage" class="index">
      <view class="index-top" :class="{ 'index-top-no-kingkong': !$indexShowKingKong }"
        :style="'padding-top:' + navHeight + 'px;'">
        <view>
          <image class="logo" :src="logoUrl" />
        </view>
        <view class="index-search">
          <view class="search-wrap">
            <image :src="srhIcon"></image>
            <input type="text" placeholder="搜索或筛选职位/公司" confirm-type="搜索" placeholder-class="placeholder"
              :disabled="true" @click="handleToSearch" />
          </view>
        </view>
        <king-kong v-if="$indexShowKingKong"></king-kong>
      </view>
      <!-- <view class="index-banner">
        <swiper indicator-active-color="#222222" autoplay indicator-dots circular>
          <swiper-item v-for="(item, index) in bannerList" :key="index">
            <image :src="item.img"></image>
          </swiper-item>
        </swiper>
      </view> -->
      <view class="index-main">
        <view class="hot-post">
          <!-- <view class="hp-title" v-if="!norMode">
            <text class="title-cont">热门职位</text>
            <text
              class="title-back"
              @click="
                norMode = true;
                handleJobList();
              "
              v-if="isModeChange"
              >返回筛选</text
            >
          </view> -->
          <view class="hp-filter-wrap">
            <view :class="['hp-filter', { fixed: filterFixed }]" :style="'top:' + navHeight + 'px;'">
              <view class="filter-post">
                <view class="post-list">
                  <text :class="['post-item', { active: activeAim === index }]" v-for="(item, index) in aimList"
                    :key="index" @click="handleAimClick(index)">{{ item.zwname || item.label }}</text>
                </view>
                <view class="add" @click="handleToAim">
                  <text class="icon add-icon"></text>
                  <view class="add-text"><text>职位意向</text></view>
                </view>
              </view>
              <view class="filter-more">
                <view class="filter-more-left">
                  <view class="btn-region" :class="{ active: !nowRegionId }" @click="handleChangeRegion('all')">全部
                  </view>
                  <view class="btn-region" :class="{ active: nowRegionId }" @click="handleChangeRegion">附近</view>
                </view>
                <view class="filter-more-right">
                  <view v-if="nowRegionId" class="region-name"><u-icon name="map" :color="$primaryColor"
                      size="28"></u-icon>
                    {{ nowRegionName }}</view>
                  <view class="filter-more-filter" @click="handleFilter"><text class="filter-text"> 筛选</text><u-icon
                      name="arrow-down-fill" size="18"></u-icon></view>
                </view>
              </view>
            </view>
          </view>

          <!-- 简历优化提示条 -->
          <view class="tip_box">
            <view class="tip_resume_Bar" v-if="isShowResumeBar">
              <view class="tip_text_area">
                <u-image :src="closeImg" width="10px" height="10px" @click="handleResumeBarClose"></u-image>
                <text class="tip_resume_status_text">你的简历已隐藏，公开可提升求职效率</text>
              </view>
              <view class="tip_btn_goOpen"  @click="handleResumeBarReset" >去公开</view>
            </view>

            <view class="tip_resume_img" v-if="isShowResumeAmend">
              <view class="tip_text_cont">
                <view class="tip_text_red">有简历优化项<span class="tip_text_black">待处理</span></view>
                <view class="tip_text_sub">提升简历质量，离高薪职位更进一步！</view>
                <u-image class="tip_btn_act" :src="resume_btnImg" width="84px" height="32px" @click="handleAmend"></u-image>
              </view>
              <u-image class="tip_image" :src="resume_bgImg" width="118px" height="95px" ></u-image>
              <u-image class="tip_img_close" :src="closeImg_gray" width="10px" height="10px" @click="handleResumeAmendClose"></u-image>
            </view>
          </view>

          
          <job-list class="hp-list" :data="postList" :props="postProp" :status="moreLoading"
            v-if="postList.length || !isSearched"></job-list>
            
          <u-empty text="暂无内容" :src="emptyImg" icon-size="378" color="#000000" font-size="32"
            v-else-if="isShowNewEmpty"></u-empty>
          <view class="no-data" v-else-if="norMode">
            <u-empty text="暂无数据">
              <view class="no-data-opt" slot="bottom">
                <u-button class="reset" :hair-line="false" :custom-style="customStyle"
                  @click="handleReset">重置筛选项</u-button>
                <!-- <u-button @click="handleModeChange">查看热门职位推荐</u-button> -->
              </view>
            </u-empty>
          </view>
        </view>
      </view>
    </view>
    <UpdatePopup></UpdatePopup>
    <!-- <vocational-assessment-activity-dialog></vocational-assessment-activity-dialog> -->
    <privacy-policy @clickBack="getPrivacyAuthStatus"></privacy-policy>
    <LoginDialog ref="loginDialog" @loginSuccessBack="loginSuccessBack"></LoginDialog>

    <!--悬浮按钮-->
    <!-- <view class="aiEnter" :animation="animationData" @click="clickActBtn">
      <u-image width="160rpx" height="213rpx" :src="aiActBtnSrc"></u-image>
      <text class="aiText">{{ animationText }}</text>
      <u-badge v-if="showAnimationBadge" :is-dot="true" type="error"></u-badge>
    </view> -->

    <view class="aiEnter" :class="[isScrolling? 'aiEnter-scrolling' : '']" :animation="animationData" @click="clickHoverBtn">
      <u-image width="160rpx" height="213rpx" :src="advButtonSrc" mode="widthFix"></u-image>
    </view>

    <!-- 大弹窗 -->
    <!-- <ActPromotion
      :show="showActPromotion"
      :backgroundSrc="alertGoods.goodsPic"
      @close="closeAlert"
      @next="clickAlert"
    ></ActPromotion> -->
  </page-wrap>
</template>

<script>
import JobList from "@/components/JobList";
import KingKong from "@/components/KingKong";
import RegionFilter from "@/components/RegionFilter";
import MoreFilter from "@/components/MoreFilter";
import UpdatePopup from "@/components/UpdatePopup";
import PrivacyPolicy from "@/components/PrivacyPolicy.vue";
import LoginDialog from "@/components/LoginDialog";
import ShareMixin from "@/mixins/share";
import LoginMixin from "@/mixins/login.js";
import { addBuryingPoint, getToastProId } from "@/api/modules/career";
import ActPromotion from "../../components/activities/activitiePromotion.vue";
import {
  getHotJob,
  getRegionByXY,
  getMyIntendedTradeList,
  searchZp,
  getIpLocation,
  getResumeAmendShowStatus,
  uploadResumeAmendShowStatus,
  getResumeBarShowStatus,
  fixResumeOnPublicStatus,
} from "@/api/index";

export default {
  mixins: [ShareMixin, LoginMixin],
  components: {
    JobList,
    KingKong,
    RegionFilter,
    MoreFilter,
    UpdatePopup,
    PrivacyPolicy,
    LoginDialog,
    ActPromotion,
  },
  data() {
    return {
      logoUrl: this.$imgBaseSelf + "home/yl-logo.png",
      activeColor: this.$primaryColor,
      personId: uni.getStorageSync("person-id").slice(2) || undefined,
      inactiveColor: "#555555",
      customStyle: {
        backgroundColor: "#E9ECEF",
        border: "none",
        color: "#555555",
      },
      regionCustomStyle: {
        backgroundColor: "tra",
        marginRight: "10rpx",
      },
      regionActiveCustomStyle: {
        backgroundColor: this.$primaryColor,
        color: "#666",
        marginRight: "10rpx",
      },
      filter: {
        region: this.$regionId,
      },
      filterList: [
        {
          name: this.$regionName || "工作地区",
          component: "RegionFilter",
          prop: "region",
          propList: ["region"],
        },
        {
          name: "筛选",
          component: "MoreFilter",
        },
      ],
      norMode:
        uni.getStorageSync("person-id") && this.$indexPostMode === "normal",
      logoSrc: this.$imgBaseSelf + "logo.png?v=" + getApp().globalData.nowDate,
      srhIcon: this.$imgBaseSelf + "home/search.png",
      bannerList: [],
      aimList: [
        {
          zwname: "",
          label: "推荐",
        },
      ],
      postList: [],
      postProp: {
        title: "jtzw",
        salary: "xzdy_new",
        cname: "cname_all",
        time: "updatetime",
        region: "regionname",
        fldy: "fldy",
        gznum: "gznum",
        edus: "edus",
        jobtypes: "jobtypes",
        yuangong: "yuangong",
      },
      pageParam: {
        page: 0,
        pageSize: 10,
      },
      moreLoading: "loadmore",
      showTop: false,
      navHeight: 0,
      nowRegionId: "",
      nowRegionName: "",
      filterFixed: false,
      mainTop: null,
      scrollTop: 0,
      activeAim: 0,
      opening: null,
      isSearched: false,
      isModeChange: false,
      emptyImg: this.$imgBase + "empty.png",
      isShowPage: false,
      buryingPointId: "",
      cardType: "",
      alertGoods: {
        goodsPic:
          this.$imgBaseSelf + "career/positionDictionary/bannerAlert_699.png", //
        goodsId: "128317245100125",
      },

      /* 弹窗按钮 */
      animationData: {},
      isScrolling: false,
      scrollintOffsetCount: 0,

      showAnimationBadge: false,
      animationText: "查看专业",
      animationTextIndex: 0,
      animationTextAry: ["查看专业", "专业评估", "查看专业", "专业评估"],
      showedPromotionAlert: false,
      aiActBtnSrc:
        this.$imgBaseSelf +
        "career/positionDictionary/college_adv_iconGif2.gif",
      showActPromotion: false,

      advButtonSrc:this.$imgBaseSelf + "offerpai/icon0.png",

      /* 简历优化提示条相关 */ 
      closeImg_gray: this.$imgBaseSelf + "common/close_gray.png",
      closeImg: this.$imgBaseSelf + "common/close_orange.png",
      resume_bgImg: this.$imgBaseSelf + "home/resume_bg2.png",
      resume_btnImg: this.$imgBaseSelf + "home/btn_red.png",
      searchBarIcon: this.$imgBaseSelf + 'career/positionDictionary/input_search_icon.webp',
      isShowResumeBar: false,
      isShowResumeAmend: false,
      
    };
  },
  computed: {
    isShowNewEmpty() {
      if (
        this.nowRegionId ||
        this.filter.salary ||
        this.filter.exp ||
        this.filter.time ||
        this.filter.edu ||
        this.filter.type
      )
        return false;
      return true;
    },
  },
  onShow() {
    // 获取用户授权状态值
    const authStatus = uni.getStorageSync("privacyAuthStatus");
    // 判断是否已经授权
    if (!authStatus) {
    } else {
      //隐私授权同意后请求数据
      this.handleAimList();
    }
    // this.getAlertToastProId();
    // this.getUserClickStorage();
  },
  created() {
    this.getResumeAmendStatus();
    this.getResumeBarStatus();

    // #ifdef MP-WEIXIN
    this.navHeight = getApp().globalData.navHeight;
    // #endif
    if (this.personId) {
      this.$bus.$emit("getUserInfo");
    }
  },
  mounted() {
    if (getApp().globalData.loginStatus === "company") {
      return;
    }
    if (this.norMode) {
      const query = uni.createSelectorQuery().in(this);
      query
        .select(".hp-filter-wrap")
        .boundingClientRect((data) => {
          this.mainTop = data.top;
        })
        .exec();
    }
    uni.setNavigationBarColor({
      frontColor: "#000000",
      backgroundColor: "#ffffff",
    });
    const loginStatus = getApp().globalData.loginStatus;
    const tabBarList =
      loginStatus === "company"
        ? getApp().globalData.companyTabs
        : loginStatus === "consultant"
          ? getApp().globalData.consultantTabs
          : getApp().globalData.personTabs;
    getApp().globalData.tabBarList = tabBarList;
  },
  onHide() {
    this.$bus.$emit("setVippopUpVisible", false);
  },
  onLoad(opt) {
    if (getApp().globalData.loginStatus === "company") {
      uni.reLaunch({ url: "/pages/library/index" });
      this.isShowPage = false;
      return;
    } else if (getApp().globalData.loginStatus === "consultant") {
      // uni.reLaunch({ url: "/pages/consultantMessage/index" });
      uni.reLaunch({ url: "/pages/message/index" });
      this.isShowPage = false;
      return;
    } else {
      this.isShowPage = true;
    }
    let that = this;
    uni.$on("filterUpdate", function (data) {
      that.filter = data;
      that.pageParam.page = 0;
      that.handleJobList();
    });

    uni.$on("aimUpdate", () => {
      this.handleAimList();
    });
  },
  onUnload() {
    uni.$off("filterUpdate");
    uni.$off("aimUpdate");
  },
  onPageScroll(res) {
    this.showTop = res.scrollTop > 0;
    this.scrollTop = res.scrollTop;
    if (this.norMode) {
      if (this.mainTop) {
        this.filterFixed = res.scrollTop > this.mainTop - this.navHeight;
        if (!this.filterFixed && this.opening) {
          this.$refs.filter.close();
        }
      }
    }

    // 列表滚动，悬浮按钮靠边处理
    // this.isScrolling = true;
    setTimeout(() => {
      this.handleScroolOffset();
    }, 1000);
  },
  
  onReachBottom() {
    this.$set(this.pageParam, "page", this.pageParam.page + 1);
    this.handleJobList(true);
  },
  // onShareAppMessage() {
  //   return {
  //     title: this.$selfName,
  //     path: "/pages/index/index",
  //   };
  // },
  // onShareTimeline() {
  //   return {
  //     title: this.$selfName,
  //     path: "/pages/index/index",
  //   };
  // },
  methods: {
    handleScroolOffset(offset) {
      if (this.scrollintOffsetCount != offset) {
        this.scrollintOffsetCount = offset;
        this.isScrolling = true;
      }else {
        this.isScrolling = false;
      }
    },

    //普通的埋点+事件停留埋点
    async addBuryingPointFn(
      etId,
      statType,
      jumpPersonId,
      jumpSource,
      sourceType
    ) {
      const params = {
        etId: etId,
        id: this.buryingPointId ? this.buryingPointId : "", //后台要求不能传空，未登录也要统计
        personId: uni.getStorageSync("person-id").slice(2) || "0",
        cardType: this.cardType
          ? this.cardType
          : uni.getStorageSync("cardType") || this.cardType,
        consultantId: uni.getStorageSync("sellId")
          ? uni.getStorageSync("sellId")
          : "",
        originType: this.originFrom == "shareLink" ? 10 : 20,
        statType: statType ? statType : "10",
        jumpPersonId: jumpPersonId,
        jumpSource: jumpSource,
        sourceType: sourceType,
      };
      const res = await addBuryingPoint(params);
    },
    handleModeChange() {
      this.norMode = false;
      this.isModeChange = true;
      this.handleJobList();
    },
    handleFilterOpen() {
      this.opening = false;
      if (this.scrollTop < this.mainTop - this.navHeight) {
        uni.pageScrollTo({
          duration: 100,
          scrollTop: this.mainTop,
        });
        setTimeout(() => {
          this.opening = true;
        }, 500);
      }
    },
    handleFilterClose() {
      this.opening = false;
    },
    // 筛选页
    handleFilter() {
      let item = encodeURIComponent(JSON.stringify(this.filter));
      uni.navigateTo({
        url: "/pagesSub/index/filter/index?item=" + item,
      });
    },
    handleAimList() {
      if (this.norMode || this.aimList.length == 1 && this.aimList[0].label == "推荐") {
        let personid = uni.getStorageSync("person-id").slice(2) || undefined;
        if (personid == undefined) {
          this.handleRegionId();
          return
        }
        let param = {
          person_id: personid,
        };
        getMyIntendedTradeList(param)
          .then((res) => {
            if (res && +res.code === 200) {
              this.aimList = res.data.myTended || [];
              this.aimList.unshift({
                zwname: "",
                label: "推荐",
              });
            }
          })
          .finally(() => {
            this.handleRegionId();
          });
      } else {
        this.handleRegionId();
      }
    },
    handleRegionId() {
      if (this.nowRegionName) return;
      let that = this;
      uni.getLocation({
        success(locationRes) {
          let param = {
            x: locationRes.latitude,
            y: locationRes.longitude,
            point: "1",
          };
          getRegionByXY(param)
            .then((res) => {
              if (
                res &&
                res.result &&
                res.result.ad_info &&
                res.result.ad_info.adcode
              ) {
                // that.nowRegionId = res.result.ad_info.adcode.slice(0, 4) + "00";
                let regionId = res.result.ad_info.adcode.slice(0, 4) + "00";
                that.nowRegionName = res.result.ad_info.city;
                uni.setStorageSync("current-region", regionId);
              } else {
                that.nowRegionId = "";
              }
              that.handleJobList();
            })
            .catch((err) => { });
          // that.showAIAlert();
        },
        fail(res) {
          // that.showAIAlert();
          getIpLocation()
            .then((res) => {
              if (res.code == 200) {
                let regionId = res.data.adcode.slice(0, 4) + "00";
                that.nowRegionName = res.data.city;
                uni.setStorageSync("current-region", regionId);
                that.handleJobList();
              } else {
                that.nowRegionId = "";
                that.handleJobList();
              }
            })
            .catch((err) => {
              that.nowRegionId = "";
              that.handleJobList();
            });
        },
      });
    },
    handleChangeRegion(type) {
      if (type == "all") {
        this.nowRegionId = "";
      } else {
        this.nowRegionId = uni.getStorageSync("current-region");
      }
      this.pageParam.page = 0;
      this.handleJobList();
    },
    handleJobList(isMore) {
      if (this.norMode) {
        return this.handleSearch(isMore);
      }
      if (this.moreLoading == "loading") return;
      this.moreLoading = "loading";
      if (this.$haveRmdPost) {
        let param = {
          tradeid: this.$tradeId,
          regionid: this.nowRegionId,
          conditionArr: JSON.stringify({
            page: this.pageParam.page,
            page_size: this.pageParam.pageSize,
          }),
        };
        // if (this.$tradeId <= 1000) {
        //   param.regionid = this.nowRegionId;
        // }
        this.postProp = {
          title: "jtzw",
          salary: "salary",
          cname: "cname_all",
          time: "updatetime",
          region: "regionName",
          fldy: "fldy",
          gznum: "gznum",
          edus: "edus",
          jobtypes: "jobtypes",
        };
        getHotJob(param).then((res) => {
          this.moreLoading = "nomore";
          if (isMore) {
            this.postList.push(...(res.data || []));
          } else {
            this.postList = res.data || [];
          }
          // this.postList.push(...res.data);
        });
      } else {
        // let regionId = this.$regionId
        //   ? this.$regionId.slice(0, 2) + "0000"
        //   : "0";
        let param = {
          tradeid: this.$tradeId,
          queryItemArr: JSON.stringify({
            regionid: this.nowRegionId || "",
            salary: this.filter.salary || "",
            gznum: this.filter.exp || "",
            itime_num: this.filter.time || "",
            eduId: this.filter.edu || "",
            jobtypes: this.filter.type || "",
          }),
          conditionArr: JSON.stringify({
            page: this.pageParam.page,
            page_size: this.pageParam.pageSize,
          }),
        };
        this.postProp = {
          title: "jtzw",
          salary: "xzdy_new",
          cname: "cname_all",
          time: "updatetime",
          region: "regionname",
          fldy: "fldy",
          gznum: "gznum",
          edus: "edus",
          jobtypes: "jobtypes",
        };
        searchZp(param).then((res) => {
          if (isMore) {
            this.postList.push(...(res.data || []));
          } else {
            this.postList = res.data || [];
          }
          if (res.data) {
            this.moreLoading = "loadmore";
            if (this.pageParam.page >= res.pageparam.pages) {
              this.moreLoading = "nomore";
            }
          } else {
            this.moreLoading = "nomore";
          }
        });
      }
    },
    // 搜索职位列表
    handleSearch(isMore) {
      if (
        isMore &&
        (this.moreLoading == "loading" || this.moreLoading == "nomore")
      )
        return;
      this.moreLoading = "loading";
      let jtzw =
        this.aimList &&
        this.aimList[this.activeAim] &&
        this.aimList[this.activeAim].zwname;
      let tradeId = this.filter.trade || this.$tradeId;
      let param = {
        tradeid: tradeId,
        queryItemArr: JSON.stringify({
          salary: this.filter.salary || "",
          regionid: this.nowRegionId || "",
          itime_num: this.filter.time || "",
          eduId: this.filter.edu || "",
          jobtypes: this.filter.type || "",
          gznum: this.filter.exp || "",
        }),
        conditionArr: JSON.stringify({
          page_size: this.pageParam.pageSize,
          yxzw_sort: "max",
          isFromType: "fromJobHome",
          check_isky: "1",
          typeName: "rec",
          person_tradeid: tradeId,
          page: this.pageParam.page,
          yxzw: jtzw || "",
          // personId: this.personId || '',
          is_mp: 1,
        }),
      };
      searchZp(param).then((res) => {
        if (isMore) {
          this.postList.push(...(res.data || []));
        } else {
          this.postList = res.data || [];
        }
        if (res.data) {
          this.moreLoading = "loadmore";
          if (this.pageParam.page >= res.pageparam.pages) {
            this.moreLoading = "nomore";
          }
        } else {
          this.moreLoading = "nomore";
        }
        this.isSearched = true;
      });
    },

    // 跳转到搜索页
    handleToSearch() {
      uni.navigateTo({ url: "/pagesSub/careerGrow/searchPos/searchPosHomeCareer" });
    },
    handleAimClick(index) {
      this.activeAim = index;
      this.pageParam.page = 0;
      this.handleJobList();
    },
    handleToAim() {
      if (!this.personId) {
        this.$refs.loginDialog.setVisibility(true);
        return;
      }
      uni.navigateTo({ url: "/pagesSub/resume/aim/index" });
    },
    handleConfirm([data, name], index) {
      if (Array.isArray(name) && Array.isArray(data)) {
        this.$set(this.filter, name[0], data[0]);
        this.$set(this.filterList[index], "activeName", data[1]);
        if (index) {
          this.$set(this.filterList[index], "activeParent", data[2]);
        }
      } else {
        this.$set(this.filter, name, data);
      }
      this.$refs.filter.close();
      this.handleSearch();
    },
    handleComFilter(data) {
      this.filter = { ...this.filter, ...data };
      this.$refs.filter.close();
      this.handleSearch();
    },
    handleReset() {
      this.filter = {
        region: "",
        trade: null,
        salary: null,
      };
      this.filterList = [
        {
          name: "工作地区",
          component: "RegionFilter",
          prop: "region",
          propList: ["region"],
        },
        {
          name: "筛选",
          component: "MoreFilter",
        },
      ];
      this.pageParam.page = 0;
      this.nowRegionId = "";
      this.handleSearch();
    },
    getPrivacyAuthStatus(privacyAuthStatus) {
      if (privacyAuthStatus) {
        this.handleAimList();
      }
    },
    loginSuccessBack() { },
    getAlertToastProId() {
      getToastProId().then((res) => {
        if (res.data) {
          console.log("---getAlertToastProId-------->", res.data);
          this.alertGoods = res.data;
        }
      });
    },


    // ====BEGIN==== 简历提示相关 ======
    // ========

    handleResumeBarClose() {
      this.isShowResumeBar = false;
      this.uploadResumeAmendStatus("mip_home_resume_bar_status");
    },
    handleResumeBarReset() {
      const params = {
        status: "1",
        person_id: this.personId,
      };
      fixResumeOnPublicStatus(params)
        .then((res) => {
          if (res.code == 200) {
            this.isShowResumeBar = false; // 隐藏简历隐藏的提示条
            uni.showToast({
              title: res.msg || '简历已公开',
              icon: 'none'
            });
          } else {
            uni.showToast({
              title: res.msg || '操作失败',
              icon: 'none'
            });
          }
        })
        .catch((err) => {
          uni.showToast({
            title: '网络异常，请稍后再试',
            icon: 'none'
          });
        });
    },

    handleAmend() {
      uni.navigateTo({
        url: '/pagesSub/newResume/index'
      });
    },

    handleResumeAmendClose() {
      this.isShowResumeAmend = false;
      this.uploadResumeAmendStatus("mip_home_resume_amend_status");
    },

    // 获取简历状态
    getResumeBarStatus() {
      if (!this.personId) {
        return;
      }
      const params = {
        yunm_module: "mip_home_resume_bar_status",
        person_id: this.personId,
      };
      getResumeBarShowStatus(params)
        .then((res) => {
          if (res.code == 200) {
            if (res.info.isShow == 1) {
              this.isShowResumeBar = true; // 显示简历隐藏的提示条
            } else {
              this.isShowResumeBar = false; // 隐藏简历隐藏的提示条
            }
          }
        })
        .catch((err) => {
        });


    },

    // 获取简历优化的显示状态
    getResumeAmendStatus() {
       if (!this.personId) {
        return;
      }
      const params = {
        yunm_module: "mip_home_resume_amend_status",
        person_id: this.personId,
      };
      getResumeAmendShowStatus(params)
        .then((res) => {
          if (res.code == 200) {
            if (res.info.isShow == 1) {
              this.isShowResumeAmend = true; // 显示简历优化提示条
            } else {
              this.isShowResumeAmend = false; // 隐藏简历优化提示条
            }
          }
        })
        .catch((err) => {
        });
    },
    // 上传简历优化状态
    uploadResumeAmendStatus(key) {
      const params = {
        yunm_module: key,
        person_id: this.personId,
      };
      uploadResumeAmendShowStatus(params)
        .then((res) => {
          console.log("🚀 ~ .then ~ res:", res);
        })
        .catch((err) => {
        });
    },


    // ========
    // ===END===== 简历提示相关 ======



    // ====BEGIN==== AI面评推广相关 ======
    // ========

    // showAIAlert() {
    //   let that = this;
    //   // 每次打开小程序只显示1次（改为每天弹一次）
    //   if (!this.showedPromotionAlert) {
    //     this.showedPromotionAlert = true;
    //     var nowTime = new Date();
    //     uni.getStorage({
    //       key: "userDidClickActCollegeAlertTime",
    //       success: function (res) {
    //         var localStorageTime = res.data;
    //         if (
    //           nowTime.getFullYear() != localStorageTime.getFullYear() ||
    //           nowTime.getMonth() != localStorageTime.getMonth() ||
    //           nowTime.getDay() != localStorageTime.getDay()
    //         ) {
    //           //年月日不同
    //           console.log(
    //             "------userDidClickActCollegeAlertTime---success-- > 1天-->",
    //             nowTime,
    //             nowTime.getFullYear(),
    //             nowTime.getMonth(),
    //             nowTime.getDay(),
    //             localStorageTime,
    //             localStorageTime.getFullYear(),
    //             localStorageTime.getMonth(),
    //             localStorageTime.getDay()
    //           );
    //           that.showActPromotion = true;
    //         } else {
    //           console.log(
    //             "------userDidClickActCollegeAlertTime---success-- < 1天-->",
    //             nowTime,
    //             nowTime.getFullYear(),
    //             nowTime.getMonth(),
    //             nowTime.getDay(),
    //             localStorageTime,
    //             localStorageTime.getFullYear(),
    //             localStorageTime.getMonth(),
    //             localStorageTime.getDay()
    //           );
    //           that.showActPromotion = false;
    //         }
    //       },
    //       fail: function () {
    //         console.log(
    //           "------userDidClickActCollegeAlertTime----fail--->",
    //           nowTime
    //         );
    //         that.showActPromotion = true;
    //       },
    //     });
    //   }
    // },

    // //检测本地记录：用户是否点击了
    // getUserClickStorage() {
    //   let that = this;

    //   uni.getStorage({
    //     key: "userDidClickActPromotionBtn",
    //     success: function (res) {
    //       that.showAnimationBadge = false;
    //     },
    //     fail: function () {
    //       that.showAnimationBadge = true;
    //       if (that.animationTextIndex >= that.animationTextAry.length) {
    //         that.animationTextIndex = 0;
    //       }
    //       that.animationText = that.animationTextAry[that.animationTextIndex];
    //       that.animationTextIndex++;
    //       that.shakeView();
    //     },
    //   });
    // },

    // // 点击推广按钮
    // clickActBtn() {
    //   if (this.showAnimationBadge) {
    //     this.showAnimationBadge = false;
    //     uni.setStorage({
    //       key: "userDidClickActPromotionBtn",
    //       data: "1",
    //       success: function () {},
    //     });
    //   }
    //   this.pointCount(1);
    //   this.clickNext();
    //   this.addBuryingPointFn(20077, "", "", "", "");
    //   return;
    //   // this.showActPromotion=true;
    //   // this.pointCount(1);
    // },
    // clickNext() {
    //   // this.showActPromotion = false;
    //   wx.reportEvent("home_alert_college_advertise_click", {}); //首页弹窗进入营销页
    //   uni.navigateTo({
    //     url: "/pagesSub/careerGrow/careerSearch/index",
    //   });
    // },

    //名企汇活动按钮点击事件
    clickHoverBtn() {
      console.log("----clickHoverBtn");
      uni.navigateTo({ url: "/pagesSub/index/search/index?form=enterprisesActivityHoverBtn" });
    },
    // // 动画配置
    shakeView() {
      const animation = uni.createAnimation({
        duration: 100,
        timingFunction: "ease-in-out",
      });
      animation
        .translateX(-10)
        .step()
        .translateX(10)
        .step()
        .translateX(-10)
        .step()
        .translateX(10)
        .step()
        .translateX(0)
        .step();
      this.animationData = animation.export();
      setTimeout(() => {
        this.resetAnimation();
      }, 500);
    },
    resetAnimation() {
      const animation = uni.createAnimation({
        duration: 0,
        timingFunction: "linear",
      });
      animation.translateX(0).step();
      this.animationData = animation.export();
    },

    // // // 数据统计
    // pointCount(step) {
    //   let eventTitle = step == 1 ? "首页按钮点击" : "首页弹窗点击";
    //   const params = {
    //     personId: this.personId,
    //     platform: "1",
    //     optCode: "aiPromotion",
    //     subOptCode: eventTitle,
    //     optIndex: step,
    //     description: "首页AI面评推广",
    //     moduleType: "demonstrate", // 模块类型(zt:职途，zph：招聘会活动-百职万岗，demonstrate：演示-扎堆)
    //   };
    // },
    // // 点击推广弹窗
    // clickAlert() {
    //   this.showActPromotion = false;
    //   var nowTime = new Date(); //点击以后一天弹一次
    //   uni.setStorage({
    //     key: "userDidClickActCollegeAlertTime",
    //     data: nowTime,
    //     success: function () {},
    //   });
    //   this.pointCount(2);
    //   // this.clickNext();
    //   this.addBuryingPointFn(20067, "", "", "", ""); //点击弹窗
    //   if (this.alertGoods.goodsId == '128317245100125') {
    //     wx.reportEvent("banner_alert_699_click", {});//进入699商品页
    //   } else {
    //     wx.reportEvent("banner_alert_8980_click", {});//进入8980商品页
    //   }
    //   // 跳转进商品详情页
    //   uni.navigateToMiniProgram({
    //     appId: "wx614f8a78fff34162",
    //     path:
    //       "/ec_goods/detail?productInstanceId=16868908125&vid=0&id=" +
    //       this.alertGoods.goodsId,
    //     success(res) {},
    //     fail(err) {},
    //   });
    // },
    // closeAlert() {
    //   this.showActPromotion = false;
    //   var nowTime = new Date(); //点击以后一天弹一次
    //   uni.setStorage({
    //     key: "userDidClickActCollegeAlertTime",
    //     data: nowTime,
    //     success: function () {},
    //   });
    //   this.pointCount(2);
    // },

    // ========
    // ===END===== AI面评推广相关 ======
  },
};
</script>

<style lang="scss">
@include img-base-self(".index .index-top", "home/top_bg.png");

::v-deep .logo {
  position: absolute;
  left: 32rpx;
  top: 50%;
  width: $logo-width;
  height: $logo-height;
  transform: translateY(-50%);
  z-index: 0;
}

::v-deep .placeholder {
  font-size: 28rpx;
  color: #999;
}

::v-deep .u-close--top-right {
  top: 5rpx !important;
  right: 5rpx !important;
}

@keyframes enterBotFramesSprites {
  100% {
    background-position: -18970px -10px; //第一个参数是网页里的最后一个数字 https://www.toptal.com/developers/css/sprite-generator
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-10px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(10px);
  }
}

.aiEnter {
  animation: shake 0.8s ease-in-out;

  position: fixed;
  bottom: 390rpx;
  // right: 30rpx;
  right: 0rpx;
  width: 160rpx;
  height: 213rpx;
  // width: 193px;
  // height: 265px;
  border-radius: 80rpx;
  // background-color: #fff;
  // box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;

  .aiText {
    display: none; //现在切的图片自带文字
    color: white;
    position: relative;
    top: -20rpx;
    background-color: #de7742;
    padding: 4rpx 15rpx;
    border-radius: 8rpx;
  }
}
.aiEnter-scrolling {
  right: -90rpx;
  opacity: 0.5;
}


.tip_box {
  width: 100%;

  .tip_resume_Bar {
    width: 100%;
    height: 35px;
    background: #FFE9E1;
    display: flex; 
    justify-content: space-between; 
    align-items: center;

    .tip_text_area {
      display: flex; 
      align-items: center; 
      margin-left: 16px;

      .tip_resume_status_text {
        font-size: 13px;
        color: #FF7846;
        margin-left: 10px;
        font-weight: 500; 
      }
    }

    .tip_btn_goOpen {
      width: 56px;
      height: 22px;
      color: white;
      background-color: #FF7846;
      border-radius: 10px;
      text-align: center; 
      padding-top: 3px;
      font-size: 12px;
      margin-right: 10px;
    }
  }

  .tip_resume_img {
    height: 136px;
    display: flex;
    justify-content: space-between; 
    margin: 8px 16px;
    background-color: white;
    border-radius: 8px;
    position: relative;

    .tip_text_cont {
      margin-left: 20px;
      margin-top: 25px;
      font-family: MiSans, MiSans;
      font-weight: 500;
      font-size: 18px;
      line-height: 18px;
      text-align: left;

      .tip_text_red {
        color: #F04646;
      }
      .tip_text_black {
        color: #141414;
      }
      .tip_text_sub {
        font-weight: 400;
        font-size: 12px;
        color: #5E5E5E;
        line-height: 12px;
        margin-top: 10px;
        margin-bottom: 19px;
      }
      .tip_btn_act {
        margin-top: 20px;
        width: 48px;
        height: 32px; 
      }
    }
    .tip_image {
      margin-top: 30px;
    }
    .tip_img_close {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 10px;
      height: 10px;
      // background-image: url($img-base + "close.png");
      background-size: cover;
      cursor: pointer;
    }
    
  }
}



.index {
  position: relative;

  .index-top {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 578rpx;
    background-size: 100% 100%;
    /* #ifdef H5 */
    background-size: 100% auto;
    background-position: center bottom;
    /* #endif */
    border-radius: 0 0 60rpx 60rpx;
    box-sizing: border-box;

    &-no-kingkong {
      height: auto;
      padding-bottom: 20rpx;
      border-radius: 0;
    }
  }

  .logo {
    width: 81rpx;
    height: 40rpx;
  }

  .index-search {
    margin: 0 32rpx;
    padding-top: 12rpx;

    .search-wrap {
      display: flex;
      align-items: center;
      padding: 0 44rpx;
      height: 80rpx;
      border-radius: 44rpx;
      background: $search-bg;

      image {
        flex-shrink: 0;
        margin-right: 16rpx;
        width: 44rpx;
        height: 44rpx;
      }

      input {
        flex: 1;
        height: 100%;
        font-size: $uni-font-size-base;
        color: #ffffff;
      }
    }
  }

  .index-banner {
    margin-top: 32rpx;
    padding: 0 32rpx;

    swiper {
      height: calc(500 * (100vw - 64rpx) / 1920);
      border-radius: 20rpx;
      overflow: hidden;

      swiper-item {
        border-radius: 20rpx;
        background: $uni-bg-color;
        overflow: hidden;

        image {
          width: 100%;
          height: auto;
        }
      }
    }
  }

  .index-main {
    padding: 0rpx 0 28rpx;
    background: $uni-bg-color-grey;

    .hot-post {
      color: $uni-text-color-222;

      .hp-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 32rpx;
        padding: 32rpx 32rpx 0;
        font-size: $uni-font-size-sec;
        font-weight: bolder;

        .title-back {
          font-size: $uni-font-size-base;
          font-weight: normal;
          color: $u-type-primary;
        }
      }

      ::v-deep .job-list {
        padding: 0 32rpx;
      }

      .hp-filter-wrap {
        height: 208rpx;

        .hp-filter {

          // padding-top: 32rpx;
          &.fixed {
            position: fixed;
            left: 0;
            top: 0;
            z-index: 10;
            width: 100%;
            background: $uni-bg-color-grey;
          }

          .filter-post {
            display: flex;
            align-items: center;
            padding: 16rpx 32rpx 14rpx 32rpx;
            margin-bottom: $uni-spacing-col-lg;
            background-color: #fff;

            .post-list {
              flex-grow: 1;
              display: flex;
              align-items: center;
              overflow: auto;

              .post-item {
                margin-left: 16rpx;
                padding: 16rpx;
                font-size: $uni-font-size-base;
                // background: $uni-text-color-grey;
                // border-radius: 28rpx;
                white-space: nowrap;

                &:first-of-type {
                  margin-left: 0;
                }

                &.active {
                  position: relative;
                  font-size: 34rpx;
                  font-weight: bold;

                  // color: #ffffff;
                  // background: $search-bg;
                  // border-radius: 33rpx;
                  &::after {
                    display: inline-block;
                    position: absolute;
                    bottom: 0;
                    left: 50%;
                    transform: translateX(-50%);
                    content: "";
                    width: 56rpx;
                    height: 14rpx;
                    background-image: url($img-base + "select.png");
                    background-repeat: no-repeat;
                    background-size: 100% 100%;
                  }
                }
              }
            }

            .add {
              flex-shrink: 0;
              // display: flex;
              // align-items: center;
              // justify-content: center;
              width: 110rpx;
              // height: 200rpx;
              // margin-top: -8rpx;
              text-align: center;
              font-size: $uni-font-size-min;
              color: $uni-text-color-666;

              // background: $uni-bg-color-grey;
              &-icon {
                width: 28rpx;
                height: 28rpx;
                margin-bottom: 6rpx;
                background-image: url($img-base + "home/icon-add.png");
                background-size: 100% 100%;
              }
            }
          }

          .filter-more {
            display: flex;
            justify-content: space-between;
            padding: 0 32rpx 24rpx 32rpx;

            &-left {
              .btn-region {
                display: inline-block;
                padding: 4rpx 16rpx;
                margin-right: 16rpx;
                color: #666;

                &.active {
                  color: $u-type-primary;
                  border-radius: $uni-border-radius-big;
                  background-color: $uni-bg-color;
                }
              }
            }

            &-right {
              .region-name {
                display: inline-block;
                font-size: 28rpx;
                margin-right: 20rpx;
                padding: 6rpx 16rpx;
                color: $u-type-primary;
                border-radius: $uni-border-radius-sm;
                background-color: $bg-color-button;
              }
            }

            &-filter {
              display: inline-block;
              color: #666;
              background-color: $uni-bg-color-border-f1;
              padding: 6rpx 16rpx;

              .filter-text {
                margin-right: 10rpx;
              }
            }

            ::v-deep .u-dropdown {
              padding: 0 32rpx;

              .u-dropdown__menu__item {
                flex: 0;
                padding-right: 32rpx;

                .u-dropdown__menu__item__text {
                  display: inline-block;
                  max-width: 100rpx;
                  color: $uni-text-color-555 !important;
                  text-overflow: ellipsis;
                  overflow: hidden;
                  white-space: nowrap;
                }

                .u-dropdown__menu__item__arrow {
                  margin-top: 2rpx !important;
                  margin-left: 8rpx !important;

                  .u-icon__icon {
                    color: $uni-text-color-222 !important;
                  }
                }
              }

              .u-dropdown__content {
                height: 100vh !important;
              }
            }

            ::v-deep .region-filter,
            ::v-deep .street-wrap {
              max-height: 54vh;
            }
          }
        }
      }
    }

    .no-data {
      margin: 0 32rpx;
      padding: 40rpx 44rpx;
      background: $uni-bg-color;
      border-radius: 24rpx;

      ::v-deep .u-empty {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;

        .u-icon__label {
          margin-bottom: 16rpx !important;
        }

        .u-slot-wrap {
          flex-grow: 1;
          margin-top: 0;
          margin-left: 44rpx;
        }

        .no-data-opt {
          flex-grow: 1;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;

          .u-btn,
          u-button {
            width: 100%;
          }

          .reset {
            margin-bottom: 24rpx;
          }
        }
      }
    }
  }
}

::v-deep .nav-wrap {
  z-index: 0;
}

.u-badge {
  padding: 4rpx 8rpx !important;
}
</style>
